#include "protocolmanager.h"

ProtocolManager::ProtocolManager(QObject *parent)
    : QObject{parent}
{
    setProtocols();
}

const QMap<Protocol, QString> &ProtocolManager::protocals()
{
    return m_protocols;
}

const QString ProtocolManager::protocolContent(Protocol p)
{
    return m_protocols.value(p);
}

const Protocol ProtocolManager::protocolName(const QString pc)
{
    return m_protocols.key(pc);
}

// 添加协议
void ProtocolManager::setProtocols()
{
    m_protocols.insert(Protocol::CallRequest, "#CALLREQUEST");
    m_protocols.insert(Protocol::Accept, "#CALLRESPONSE^YES");
    m_protocols.insert(Protocol::Refuse, "#CALLRESPONSE^NO");
    m_protocols.insert(Protocol::HangUp, "#HANGUP");
    m_protocols.insert(Protocol::Cancel, "#MANUALCANCEL");
//    m_protocols.insert(Protocol::Timeout, "#Timeout");
}
